package com.yehangtech.designpattern.结构型_享元模式.controller;


import com.yehangtech.designpattern.结构型_享元模式.entity.Activity;
import com.yehangtech.designpattern.结构型_享元模式.entity.Stock;
import com.yehangtech.designpattern.结构型_享元模式.factory.ActivityFactory;
import com.yehangtech.designpattern.结构型_享元模式.utils.RedisUtil;

public class ActivityController {
    private final RedisUtil redisUtil=new RedisUtil();

    public Activity getActivityById(Long id){
        Activity activity = ActivityFactory.getActivity(id);
        int stockUsed = redisUtil.getStockUsed();
        activity.setStock(new Stock(1000,stockUsed));
        return activity;
    }

}
